import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:gourmet/color/hex.dart';
import 'package:gourmet/extensions/ex_widget.dart';
import 'package:gourmet/route/index.dart';
import 'package:gourmet/utils/colors.dart';
import 'package:gourmet/utils/radian.dart';
import 'package:gourmet/utils/styles.dart';
import 'package:gourmet/utils/svg.dart';

class ReceiveAddressManageController extends GetxController {}

class ReceiveAdressManagePage extends GetView<ReceiveAddressManageController> {
  const ReceiveAdressManagePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        leading: IconButton(
          onPressed: Get.back,
          icon: Icon(
            CupertinoIcons.chevron_back,
            size: 20.sp,
            color: HexColor(ColorsUtils.color0000),
          ),
        ),
        title: Text(
          '收货地址管理',
          style: StylesUtils.customTextStyle(
            fontSize: StylesUtils.fontSize16,
            fontWeight: FontWeight.w700,
            color: ColorsUtils.color0000,
          ),
        ),
        centerTitle: true,
        systemOverlayStyle: SystemUiOverlayStyle.dark,
        backgroundColor: Colors.white,
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Padding(
              padding: const EdgeInsets.only(top: 30, left: 15, right: 20),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  Expanded(
                    child: Column(
                      children: [
                        Container(
                          alignment: Alignment.centerLeft,
                          child: Text.rich(
                            TextSpan(
                              children: [
                                WidgetSpan(
                                    child: Container(
                                      constraints: const BoxConstraints.expand(
                                          width: 30, height: 16),
                                      alignment: Alignment.center,
                                      decoration: BoxDecoration(
                                        //linear-gradient(90deg, rgba(255, 110, 83, 1) 0%, rgba(255, 110, 83, 1) 0%, rgba(255, 84, 53, 1) 100%, rgba(255, 84, 53, 1) 100%)
                                        gradient: LinearGradient(
                                          colors: [
                                            ColorsUtils.rgba(255, 110, 83, 1),
                                            ColorsUtils.rgba(255, 110, 83, 1),
                                            ColorsUtils.rgba(255, 84, 53, 1),
                                            ColorsUtils.rgba(255, 84, 53, 1)
                                          ],
                                          stops: const [0.0, 0.0, 1.0, 1.0],
                                          begin: Alignment.centerLeft,
                                          end: Alignment.centerRight,
                                          transform: GradientRotation(
                                              RadianUtils.angleToRadian(90)),
                                        ),
                                      ),
                                      child: Text(
                                        '公司',
                                        style: StylesUtils.customTextStyle(
                                          fontSize: StylesUtils.fontSize12,
                                        ),
                                      ),
                                    ),
                                    alignment: PlaceholderAlignment.middle),
                                TextSpan(
                                  text: ' 北海市海城区486号大道东方银座大厦C座',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize15,
                                      color: ColorsUtils.color0000,
                                      lineHeight: 1.4),
                                ),
                              ],
                            ),
                          ),
                        ),
                        Container(
                          margin: const EdgeInsets.only(top: 10),
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '王先生   +8613612345678',
                            style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color9999,
                              fontSize: StylesUtils.fontSize13,
                            ),
                          ),
                        ),
                        Divider(
                          height: 30,
                          color: HexColor(ColorsUtils.colorF5f5),
                          indent: 10,
                          endIndent: 10,
                          thickness: 1,
                        ),
                      ],
                    ).paddingOnly(right: 10),
                  ),
                  Container(
                    margin: const EdgeInsets.only(top: 10),
                    alignment: Alignment.center,
                    child: SvgUtils.assetName('u1909', width: 18, height: 17),
                  ).onTap(() {}),
                ],
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(left: 15, right: 20),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  Expanded(
                    child: Column(
                      children: [
                        Container(
                          alignment: Alignment.centerLeft,
                          child: Text.rich(
                            TextSpan(
                              children: [
                                WidgetSpan(
                                    child: Container(
                                      constraints: const BoxConstraints.expand(
                                          width: 30, height: 16),
                                      alignment: Alignment.center,
                                      decoration: BoxDecoration(
                                        //linear-gradient(90deg, rgba(102, 204, 0, 1) 0%, rgba(102, 204, 0, 1) 0%, rgba(99, 181, 75, 1) 100%, rgba(99, 181, 75, 1) 100%)
                                        gradient: LinearGradient(
                                          colors: [
                                            ColorsUtils.rgba(102, 204, 0, 1),
                                            ColorsUtils.rgba(102, 204, 0, 1),
                                            ColorsUtils.rgba(99, 181, 75, 1),
                                            ColorsUtils.rgba(99, 181, 75, 1)
                                          ],
                                          stops: const [0.0, 0.0, 1.0, 1.0],
                                          begin: Alignment.centerLeft,
                                          end: Alignment.centerRight,
                                          transform: GradientRotation(
                                              RadianUtils.angleToRadian(90)),
                                        ),
                                      ),
                                      child: Text(
                                        '家',
                                        style: StylesUtils.customTextStyle(
                                          fontSize: StylesUtils.fontSize12,
                                        ),
                                      ),
                                    ),
                                    alignment: PlaceholderAlignment.middle),
                                TextSpan(
                                  text: ' 北海市银海区西南大道96号龙岭',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize15,
                                      color: ColorsUtils.color0000,
                                      lineHeight: 1.4),
                                ),
                              ],
                            ),
                          ),
                        ),
                        Container(
                          margin: const EdgeInsets.only(top: 10),
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '赵小姐   +8613612345678',
                            style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color9999,
                              fontSize: StylesUtils.fontSize13,
                            ),
                          ),
                        ),
                        Divider(
                          height: 30,
                          color: HexColor(ColorsUtils.colorF5f5),
                          indent: 10,
                          endIndent: 10,
                          thickness: 1,
                        ),
                      ],
                    ).paddingOnly(right: 10),
                  ),
                  Container(
                    margin: const EdgeInsets.only(top: 10),
                    alignment: Alignment.center,
                    child: SvgUtils.assetName('u1909', width: 18, height: 17),
                  ).onTap(() {}),
                ],
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(left: 15, right: 20),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  Expanded(
                    child: Column(
                      children: [
                        Container(
                          alignment: Alignment.centerLeft,
                          child: Text.rich(
                            TextSpan(
                              children: [
                                WidgetSpan(
                                    child: Container(
                                      constraints: const BoxConstraints.expand(
                                          width: 30, height: 16),
                                      alignment: Alignment.center,
                                      decoration: BoxDecoration(
                                        //linear-gradient(90deg, rgba(52, 120, 246, 1) 0%, rgba(52, 120, 246, 1) 0%, rgba(0, 102, 204, 1) 100%, rgba(0, 102, 204, 1) 100%)
                                        gradient: LinearGradient(
                                          colors: [
                                            ColorsUtils.rgba(52, 120, 246, 1),
                                            ColorsUtils.rgba(52, 102, 246, 1),
                                            ColorsUtils.rgba(0, 102, 201, 1),
                                            ColorsUtils.rgba(0, 102, 201, 1)
                                          ],
                                          stops: const [0.0, 0.0, 1.0, 1.0],
                                          begin: Alignment.centerLeft,
                                          end: Alignment.centerRight,
                                          transform: GradientRotation(
                                              RadianUtils.angleToRadian(90)),
                                        ),
                                      ),
                                      child: Text(
                                        '学校',
                                        style: StylesUtils.customTextStyle(
                                          fontSize: StylesUtils.fontSize12,
                                        ),
                                      ),
                                    ),
                                    alignment: PlaceholderAlignment.middle),
                                TextSpan(
                                  text: ' 北海市银海区西南大道国际学校小学部',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize15,
                                      color: ColorsUtils.color0000,
                                      lineHeight: 1.4),
                                ),
                              ],
                            ),
                          ),
                        ),
                        Container(
                          margin: const EdgeInsets.only(top: 10),
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '赵小姐   +8613612345678',
                            style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color9999,
                              fontSize: StylesUtils.fontSize13,
                            ),
                          ),
                        ),
                        Divider(
                          height: 30,
                          color: HexColor(ColorsUtils.colorF5f5),
                          indent: 10,
                          endIndent: 10,
                          thickness: 1,
                        ),
                      ],
                    ).paddingOnly(right: 10),
                  ),
                  Container(
                    margin: const EdgeInsets.only(top: 10),
                    alignment: Alignment.center,
                    child: SvgUtils.assetName('u1909', width: 18, height: 17),
                  ).onTap(() {}),
                ],
              ),
            ),
            Padding(
              padding: const EdgeInsets.only(left: 15, right: 20),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.start,
                children: [
                  Expanded(
                    child: Column(
                      children: [
                        Container(
                          alignment: Alignment.centerLeft,
                          child: Text.rich(
                            TextSpan(
                              children: [
                                TextSpan(
                                  text: ' 北海市银海区西南大道国际学校初中部',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: StylesUtils.fontSize15,
                                      color: ColorsUtils.color0000,
                                      lineHeight: 1.4),
                                ),
                              ],
                            ),
                          ),
                        ),
                        Container(
                          margin: const EdgeInsets.only(top: 10),
                          alignment: Alignment.centerLeft,
                          child: Text(
                            '赵小姐   +8613612345678',
                            style: StylesUtils.customTextStyle(
                              color: ColorsUtils.color9999,
                              fontSize: StylesUtils.fontSize13,
                            ),
                          ),
                        ),
                        Divider(
                          height: 30,
                          color: HexColor(ColorsUtils.colorF5f5),
                          indent: 10,
                          endIndent: 10,
                          thickness: 1,
                        ),
                      ],
                    ).paddingOnly(right: 10),
                  ),
                  Container(
                    margin: const EdgeInsets.only(top: 10),
                    alignment: Alignment.center,
                    child: SvgUtils.assetName('u1909', width: 18, height: 17),
                  ).onTap(() {}),
                ],
              ),
            ),
          ],
        ),
      ),
      bottomNavigationBar: SafeArea(
        bottom: true,
        child: Container(
          padding: const EdgeInsets.symmetric(horizontal: 10),
          height: 65,
          alignment: Alignment.center,
          child: Container(
            constraints: const BoxConstraints.expand(width: 235, height: 45),
            alignment: Alignment.center,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(23),
              gradient: LinearGradient(
                //linear-gradient(90deg, rgba(255, 153, 0, 1) 0%, rgba(255, 153, 0, 1) 0%, rgba(254, 70, 1, 1) 100%, rgba(254, 70, 1, 1) 100%)
                colors: [
                  ColorsUtils.rgba(255, 153, 0, 1),
                  ColorsUtils.rgba(255, 153, 0, 1),
                  ColorsUtils.rgba(254, 70, 1, 1),
                  ColorsUtils.rgba(254, 70, 1, 1)
                ],
                stops: const [0.0, 0.0, 1.0, 1.0],
                begin: Alignment.centerLeft,
                end: Alignment.centerRight,
                transform: GradientRotation(RadianUtils.angleToRadian(90)),
              ),
            ),
            child: Text(
              '✚ 新增地址',
              style: StylesUtils.customTextStyle(
                fontSize: StylesUtils.fontSize16,
              ),
            ),
          ).onTap(() {
            Get.toNamed(Routes.mineReceiveAddressAdd);
          }),
        ),
      ),
    );
  }
}
